package com.yunhe.policyfulfillment.config;

import com.yunhe.policyfulfillment.interceptor.RequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName WebAppConfig
 * @Description TODO
 * @Author HeTao
 * @Date 2021/7/21 15:36
 * @Version 1.0
 **/
@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Autowired
    private RequestInterceptor requestInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(requestInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/**/*.js","/**/*.css","/**/*.png","/**/*.jpg","/**/*.css","/**/*.ttf")
                .excludePathPatterns("/swagger-resources/**","/swagger-ui.html/**","/login/**","/v2/**")
                .excludePathPatterns("/portal/**")
                .excludePathPatterns("/files/getFile", "/files/uploadFile")
                .excludePathPatterns("/policyMenu/searchPolicyMenuListByRoleIdForLogin")
                .excludePathPatterns("/publishTimed/**");
    }

}
